
{% extends "base.html" %}
{% set title = "专业列表" %}

{% block content %}
    <h3>专业列表</h3>

    <table class="table table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>专业名称</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for major in majors %}
            <tr>
                <td>{{ major.id }}</td>
                <td>{{ major.name }}</td>
                <td>
                    {% if "uid" in session and session['is_admin'] %}
                    <a href="{{ url_for('edit_major', id=major.id) }}" class="btn btn-warning btn-sm">编辑</a>
                    <a href="{{ url_for('delete_major', id=major.id) }}" class="btn btn-danger btn-sm">删除</a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    <br>

    {% if "uid" in session and session['is_admin'] %}
    <a href="{{ url_for('add_major') }}" class="btn btn-primary mb-3">添加专业</a><br>
    {% endif %}
    <a href="{{ url_for('logout') }}" class="btn btn-secondary mb-3">登出</a>

{% endblock %}
